//
//  KeShiKaoQingTopView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/5/31.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "KeShiKaoQingTopView.h"

@implementation KeShiKaoQingTopView

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.titleLabel];
    [self addSubview:self.xueHaoLabel];
    [self addSubview:self.keChengLabel];
    [self addSubview:self.renKeLaoShiLabel];
    [self addSubview:self.jiaoShiLabel];
    [self addSubview:self.shangKeShiJianLabel];
    [self addSubview:self.keMuLabel];
    [self addSubview:self.kaoQingRenShuLabel];
    [self addSubview:self.backView];
    [_backView addSubview:self.topLabel];
    [self addSubview:self.lineView];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(@10);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@13);
    }];
    [_xueHaoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.titleLabel.mas_top);
        make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_keChengLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(11);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@12);
    }];
    [_renKeLaoShiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(11);
        make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_jiaoShiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(self.keChengLabel.mas_bottom).offset(11);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@13);
    }];
    [_shangKeShiJianLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.keChengLabel.mas_bottom).offset(11);
        make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_keMuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(self->_shangKeShiJianLabel.mas_bottom).offset(11);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@13);
    }];
    [_kaoQingRenShuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self->_shangKeShiJianLabel.mas_bottom).offset(11);
         make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.bottom.equalTo(self.mas_bottom).offset(-1);
        make.right.equalTo(@0);
        make.height.equalTo(@30);
    }];
    [_topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(@0);
        make.width.equalTo(@300);
        make.height.equalTo(@30);
    }];

    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.top.equalTo(self.backView.mas_bottom);
        make.right.equalTo(@0);
        make.height.equalTo(@1);
    }];
}
- (UIView *)backView{
    if (!_backView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = CONTENTBACKCOLOR;
        _backView = view;
    }
    return _backView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330.5,79.5,140.5,13);
        label.numberOfLines = 0;
        label.text = @"单茹 18 新一 1-D 六A";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = SELECTEDCOLOR;
        _titleLabel = label;
    }
    return _titleLabel;
}
- (UILabel *)xueHaoLabel{
    if (!_xueHaoLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330.5,79.5,140.5,13);
        label.numberOfLines = 0;
        label.text = @"学号：S1356 ";
        label.font = [UIFont systemFontOfSize:12];
        label.textColor = TITLECOLOR;
        label.attributedText = [PublickFunctionObject getPriceAttribute:label.text and:[UIColor redColor] andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _xueHaoLabel = label;
    }
    return _xueHaoLabel;
}
- (UILabel *)keChengLabel{
    if (!_keChengLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"课程名称：音标+新一1期1-34次 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _keChengLabel = label;
    }
    return _keChengLabel;
}
- (UILabel *)renKeLaoShiLabel{
    if (!_renKeLaoShiLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.text = @"任课老师：候园/单茹,李梦迪";
        _renKeLaoShiLabel = label;
    }
    return _renKeLaoShiLabel;
}
- (UILabel *)jiaoShiLabel{
    if (!_jiaoShiLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"年级：3-6年级 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _jiaoShiLabel = label;
    }
    return _jiaoShiLabel;
}
- (UILabel *)shangKeShiJianLabel{
    if (!_shangKeShiJianLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"上课时间：周六07:50~09:50 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _shangKeShiJianLabel = label;
    }
    return _shangKeShiJianLabel;
}
- (UILabel *)keMuLabel{
    if (!_keMuLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"科目：" and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
        _keMuLabel = label;
    }
    return _keMuLabel;
}
- (UILabel *)kaoQingRenShuLabel{
    if (!_kaoQingRenShuLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"招生人数：" and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
        _kaoQingRenShuLabel = label;
    }
    return _kaoQingRenShuLabel;
}
- (UILabel *)topLabel{
    if (!_topLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.textAlignment = 1;
        label.font = [UIFont systemFontOfSize:12];
        label.text = @"请假：0  旷课：0  早退：0  迟到：0";
        _topLabel = label;
    }
    return _topLabel;
}
- (UIView *)lineView{
    if (!_lineView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = LINCOLOR;
        _lineView = view;
    }
    return _lineView;
}
- (void)setTitleLabelValue:(NSString *)string{
    _titleLabel.text = string;
}
- (void)setXueHaoLabelValue:(NSString *)string{
    NSString *value = [NSString stringWithFormat:@"学号：%@",string];
    _xueHaoLabel.attributedText = [PublickFunctionObject getPriceAttribute:value and:[UIColor redColor] andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setKeChengLabelValue:(NSString *)string{
    string = string.length>0?string:@"";
    NSString *value = [NSString stringWithFormat:@"课程名称：%@",string];
    _keChengLabel.attributedText = [PublickFunctionObject getPriceAttribute:value and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setRenKeLaoShiLabelValue:(NSString *)string{
    _renKeLaoShiLabel.text = [NSString stringWithFormat:@"任课老师：%@",string];
}
- (void)setJiaoShiLabelValue:(NSString *)string{
    NSString *value = [NSString stringWithFormat:@"教室：%@",string];
    _jiaoShiLabel.attributedText = [PublickFunctionObject getPriceAttribute:value and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setShangKeShiJianLabelValue:(NSString *)string{
    NSString *value = [NSString stringWithFormat:@"上课时间：%@",string];
    _shangKeShiJianLabel.attributedText = [PublickFunctionObject getPriceAttribute:value and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setKeMuLabelValue:(NSString *)string{
    NSString *value = [NSString stringWithFormat:@"科目：%@",string];
    _shangKeShiJianLabel.attributedText = [PublickFunctionObject getPriceAttribute:value and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setKaoQingLabelValue:(NSString *)string{
    NSString *value = [NSString stringWithFormat:@"招生人数：%@",string];
    _shangKeShiJianLabel.attributedText = [PublickFunctionObject getPriceAttribute:value and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
@end
